package com.jar.exercise.多线程.守护线程;

import lombok.SneakyThrows;

import java.util.concurrent.TimeUnit;

public class Main {
    public static void main(String[] args) throws InterruptedException {

        Thread thread = new Thread(new DaemonThread());
        thread.setDaemon(true);
        thread.start();
        TimeUnit.SECONDS.sleep(10);

    }
}

class DaemonThread implements Runnable {
    @SneakyThrows
    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.println(Thread.currentThread().getName() + "::"+i);
            TimeUnit.SECONDS.sleep(1);
        }
    }
}